<template>
	<view class="header">
		<view class="content">
			<view class="info-box">
				<view class="info-img" style="border-radius:50%; overflow: hidden;" v-if="avatarUrl">
					<open-data type="userAvatarUrl" style="border-radius:50%;"></open-data>
				</view>
				<view class="info-img" v-else>
					<button open-type="getUserInfo" @getuserinfo="bindGetUserInfo">	</button>
					<image class="info-bg" src="../static/user.png"></image>
				</view>
				
				<view class="info-text">
					<text>个人中心</text>
				</view>
			</view>
			<view class="search" @click="handleSearch">
				<view class="search-icon">
					<view class="searchbtn">&#xe613;</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { common } from '@/common/publish.js';
	export default {
		data() {
			return {
				
			};
		},
		computed:{
			avatarUrl(){
				return this.$store.state.avatarUrl
			}
		},
		methods:{
			handleSearch(){
				uni.navigateTo({
					'url':'/pages/search/search'
				})
			},
			dolishi(){
				uni.navigateTo({
					url:'/pages/history/history'
				})
			},
			 bindGetUserInfo(e){
				 common.bindGetUserInfo.call(this,e)
			}	 
			
		}
	}
</script>

<style lang="scss">
	@font-face {
		font-family: texticons;
		font-weight: normal;
		font-style: normal;
		src: url('.././static/font/iconfont.ttf') format('truetype');
	}
	%flex-center{
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.header{
		width: 100%;
		height: 268upx;
		background: $index-bg-base-code;
		background-size: cover;
		padding: 10upx 30upx 0;
	}
	.content{
		display: flex;
		justify-content: space-between;
		flex-direction: row;
		.info-box{
			display: flex;
			flex-direction: row;
			align-items: center;
			.info-img{
				width: 50upx;
				height: 50upx;
				position: relative;
				button{
					width: 100%;
					height: 100%;
					position: absolute;
					left: 0;
					top: 0;
					opacity: 0;
					z-index: 999;
				}
				image{
					width: 50upx;
					height: 50upx;
					position: absolute;
					left: 0;
					top: 0;
					z-index: 500;
				}
			}
			.info-text{
				margin-left: 10upx;
				text{
					font-size: 28upx;
					color: #FFFFFF;
				}
			}
		}
	}
	.search{
		width: 50upx;
		height: 50upx;
		background: rgba(28,110,167,1);
		border-radius: 50%;
	}
	.search-icon{
		width: 50upx;
		height: 50upx;
		text-align: center;
	}
	.searchbtn{
		color: #FFFFFF;
		width: 50upx;
		height: 50upx;
		line-height:50upx;
		font-size: 40upx;
		font-family: texticons;
	}
</style>
